Optimal. Leaf size=143 \[ -\frac {\left (2 a b B-2 a^2 C-b^2 C\right ) \tanh ^{-1}(\sin (c+d x))}{2 b^3 d}+\frac {2 a^2 (b B-a C) \tanh ^{-1}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{\sqrt {a-b} b^3 \sqrt {a+b} d}+\frac {(b B-a C) \tan (c+d x)}{b^2 d}+\frac {C \sec (c+d x) \tan (c+d x)}{2 b d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.33, antiderivative size = 143, normalized size of antiderivative = 1.00, number of steps
used = 8, number of rules used = 8, integrand size = 40, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.200, Rules used = {4157, 4118,
4167, 4083, 3855, 3916, 2738, 214} \begin {gather*} \frac {2 a^2 (b B-a C) \tanh ^{-1}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{b^3 d \sqrt {a-b} \sqrt {a+b}}-\frac {\left (-2 a^2 C+2 a b B-b^2 C\right ) \tanh ^{-1}(\sin (c+d x))}{2 b^3 d}+\frac {(b B-a C) \tan (c+d x)}{b^2 d}+\frac {C \tan (c+d x) \sec (c+d x)}{2 b d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 214
Rule 2738
Rule 3855
Rule 3916
Rule 4083
Rule 4118
Rule 4157
Rule 4167
Rubi steps
\begin {align*} \int \frac {\sec ^2(c+d x) \left (B \sec (c+d x)+C \sec ^2(c+d x)\right )}{a+b \sec (c+d x)} \, dx &=\int \frac {\sec ^3(c+d x) (B+C \sec (c+d x))}{a+b \sec (c+d x)} \, dx\\ &=\frac {C \sec (c+d x) \tan (c+d x)}{2 b d}+\frac {\int \frac {\sec (c+d x) \left (a C+b C \sec (c+d x)+2 (b B-a C) \sec ^2(c+d x)\right )}{a+b \sec (c+d x)} \, dx}{2 b}\\ &=\frac {(b B-a C) \tan (c+d x)}{b^2 d}+\frac {C \sec (c+d x) \tan (c+d x)}{2 b d}+\frac {\int \frac {\sec (c+d x) \left (a b C-\left (2 a b B-2 a^2 C-b^2 C\right ) \sec (c+d x)\right )}{a+b \sec (c+d x)} \, dx}{2 b^2}\\ &=\frac {(b B-a C) \tan (c+d x)}{b^2 d}+\frac {C \sec (c+d x) \tan (c+d x)}{2 b d}+\frac {\left (a^2 (b B-a C)\right ) \int \frac {\sec (c+d x)}{a+b \sec (c+d x)} \, dx}{b^3}-\frac {\left (2 a b B-2 a^2 C-b^2 C\right ) \int \sec (c+d x) \, dx}{2 b^3}\\ &=-\frac {\left (2 a b B-2 a^2 C-b^2 C\right ) \tanh ^{-1}(\sin (c+d x))}{2 b^3 d}+\frac {(b B-a C) \tan (c+d x)}{b^2 d}+\frac {C \sec (c+d x) \tan (c+d x)}{2 b d}+\frac {\left (a^2 (b B-a C)\right ) \int \frac {1}{1+\frac {a \cos (c+d x)}{b}} \, dx}{b^4}\\ &=-\frac {\left (2 a b B-2 a^2 C-b^2 C\right ) \tanh ^{-1}(\sin (c+d x))}{2 b^3 d}+\frac {(b B-a C) \tan (c+d x)}{b^2 d}+\frac {C \sec (c+d x) \tan (c+d x)}{2 b d}+\frac {\left (2 a^2 (b B-a C)\right ) \text {Subst}\left (\int \frac {1}{1+\frac {a}{b}+\left (1-\frac {a}{b}\right ) x^2} \, dx,x,\tan \left (\frac {1}{2} (c+d x)\right )\right )}{b^4 d}\\ &=-\frac {\left (2 a b B-2 a^2 C-b^2 C\right ) \tanh ^{-1}(\sin (c+d x))}{2 b^3 d}+\frac {2 a^2 (b B-a C) \tanh ^{-1}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{\sqrt {a-b} b^3 \sqrt {a+b} d}+\frac {(b B-a C) \tan (c+d x)}{b^2 d}+\frac {C \sec (c+d x) \tan (c+d x)}{2 b d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] Leaf count is larger than twice the leaf count of optimal. \(300\) vs. \(2(143)=286\).
time = 1.96, size = 300, normalized size = 2.10 \begin {gather*} \frac {\frac {8 a^2 (-b B+a C) \tanh ^{-1}\left (\frac {(-a+b) \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a^2-b^2}}\right )}{\sqrt {a^2-b^2}}-2 \left (-2 a b B+2 a^2 C+b^2 C\right ) \log \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )+2 \left (-2 a b B+2 a^2 C+b^2 C\right ) \log \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )+\frac {b^2 C}{\left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )^2}+\frac {4 b (b B-a C) \sin \left (\frac {1}{2} (c+d x)\right )}{\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )}-\frac {b^2 C}{\left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )^2}+\frac {4 b (b B-a C) \sin \left (\frac {1}{2} (c+d x)\right )}{\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )}}{4 b^3 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.26, size = 229, normalized size = 1.60
method | result | size |
derivativedivides | \(\frac {\frac {C}{2 b \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )^{2}}-\frac {2 b B -2 a C -C b}{2 b^{2} \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}+\frac {\left (2 a b B -2 a^{2} C -b^{2} C \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{2 b^{3}}-\frac {C}{2 b \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{2}}-\frac {2 b B -2 a C -C b}{2 b^{2} \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}+\frac {\left (-2 a b B +2 a^{2} C +b^{2} C \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{2 b^{3}}+\frac {2 a^{2} \left (b B -a C \right ) \arctanh \left (\frac {\left (a -b \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\sqrt {\left (a +b \right ) \left (a -b \right )}}\right )}{b^{3} \sqrt {\left (a +b \right ) \left (a -b \right )}}}{d}\) | \(229\) |
default | \(\frac {\frac {C}{2 b \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )^{2}}-\frac {2 b B -2 a C -C b}{2 b^{2} \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}+\frac {\left (2 a b B -2 a^{2} C -b^{2} C \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{2 b^{3}}-\frac {C}{2 b \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{2}}-\frac {2 b B -2 a C -C b}{2 b^{2} \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}+\frac {\left (-2 a b B +2 a^{2} C +b^{2} C \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{2 b^{3}}+\frac {2 a^{2} \left (b B -a C \right ) \arctanh \left (\frac {\left (a -b \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\sqrt {\left (a +b \right ) \left (a -b \right )}}\right )}{b^{3} \sqrt {\left (a +b \right ) \left (a -b \right )}}}{d}\) | \(229\) |
risch | \(-\frac {i \left (C b \,{\mathrm e}^{3 i \left (d x +c \right )}-2 B b \,{\mathrm e}^{2 i \left (d x +c \right )}+2 C a \,{\mathrm e}^{2 i \left (d x +c \right )}-C b \,{\mathrm e}^{i \left (d x +c \right )}-2 b B +2 a C \right )}{b^{2} d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{2}}+\frac {a^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a^{2}-i b^{2}+\sqrt {a^{2}-b^{2}}\, b}{a \sqrt {a^{2}-b^{2}}}\right ) B}{\sqrt {a^{2}-b^{2}}\, d \,b^{2}}-\frac {a^{3} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a^{2}-i b^{2}+\sqrt {a^{2}-b^{2}}\, b}{a \sqrt {a^{2}-b^{2}}}\right ) C}{\sqrt {a^{2}-b^{2}}\, d \,b^{3}}-\frac {a^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {-i a^{2}+i b^{2}+\sqrt {a^{2}-b^{2}}\, b}{a \sqrt {a^{2}-b^{2}}}\right ) B}{\sqrt {a^{2}-b^{2}}\, d \,b^{2}}+\frac {a^{3} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {-i a^{2}+i b^{2}+\sqrt {a^{2}-b^{2}}\, b}{a \sqrt {a^{2}-b^{2}}}\right ) C}{\sqrt {a^{2}-b^{2}}\, d \,b^{3}}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) a B}{b^{2} d}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) a^{2} C}{b^{3} d}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) C}{2 b d}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) a B}{b^{2} d}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) a^{2} C}{b^{3} d}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) C}{2 b d}\) | \(520\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: ValueError} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 276 vs.
\(2 (130) = 260\).
time = 9.62, size = 609, normalized size = 4.26 \begin {gather*} \left [-\frac {2 \, {\left (C a^{3} - B a^{2} b\right )} \sqrt {a^{2} - b^{2}} \cos \left (d x + c\right )^{2} \log \left (\frac {2 \, a b \cos \left (d x + c\right ) - {\left (a^{2} - 2 \, b^{2}\right )} \cos \left (d x + c\right )^{2} + 2 \, \sqrt {a^{2} - b^{2}} {\left (b \cos \left (d x + c\right ) + a\right )} \sin \left (d x + c\right ) + 2 \, a^{2} - b^{2}}{a^{2} \cos \left (d x + c\right )^{2} + 2 \, a b \cos \left (d x + c\right ) + b^{2}}\right ) - {\left (2 \, C a^{4} - 2 \, B a^{3} b - C a^{2} b^{2} + 2 \, B a b^{3} - C b^{4}\right )} \cos \left (d x + c\right )^{2} \log \left (\sin \left (d x + c\right ) + 1\right ) + {\left (2 \, C a^{4} - 2 \, B a^{3} b - C a^{2} b^{2} + 2 \, B a b^{3} - C b^{4}\right )} \cos \left (d x + c\right )^{2} \log \left (-\sin \left (d x + c\right ) + 1\right ) - 2 \, {\left (C a^{2} b^{2} - C b^{4} - 2 \, {\left (C a^{3} b - B a^{2} b^{2} - C a b^{3} + B b^{4}\right )} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{4 \, {\left (a^{2} b^{3} - b^{5}\right )} d \cos \left (d x + c\right )^{2}}, -\frac {4 \, {\left (C a^{3} - B a^{2} b\right )} \sqrt {-a^{2} + b^{2}} \arctan \left (-\frac {\sqrt {-a^{2} + b^{2}} {\left (b \cos \left (d x + c\right ) + a\right )}}{{\left (a^{2} - b^{2}\right )} \sin \left (d x + c\right )}\right ) \cos \left (d x + c\right )^{2} - {\left (2 \, C a^{4} - 2 \, B a^{3} b - C a^{2} b^{2} + 2 \, B a b^{3} - C b^{4}\right )} \cos \left (d x + c\right )^{2} \log \left (\sin \left (d x + c\right ) + 1\right ) + {\left (2 \, C a^{4} - 2 \, B a^{3} b - C a^{2} b^{2} + 2 \, B a b^{3} - C b^{4}\right )} \cos \left (d x + c\right )^{2} \log \left (-\sin \left (d x + c\right ) + 1\right ) - 2 \, {\left (C a^{2} b^{2} - C b^{4} - 2 \, {\left (C a^{3} b - B a^{2} b^{2} - C a b^{3} + B b^{4}\right )} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{4 \, {\left (a^{2} b^{3} - b^{5}\right )} d \cos \left (d x + c\right )^{2}}\right ] \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \frac {\left (B + C \sec {\left (c + d x \right )}\right ) \sec ^{3}{\left (c + d x \right )}}{a + b \sec {\left (c + d x \right )}}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 269 vs.
\(2 (130) = 260\).
time = 0.52, size = 269, normalized size = 1.88 \begin {gather*} \frac {\frac {{\left (2 \, C a^{2} - 2 \, B a b + C b^{2}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right )}{b^{3}} - \frac {{\left (2 \, C a^{2} - 2 \, B a b + C b^{2}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right )}{b^{3}} - \frac {4 \, {\left (C a^{3} - B a^{2} b\right )} {\left (\pi \left \lfloor \frac {d x + c}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (-2 \, a + 2 \, b\right ) + \arctan \left (-\frac {a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{\sqrt {-a^{2} + b^{2}}}\right )\right )}}{\sqrt {-a^{2} + b^{2}} b^{3}} + \frac {2 \, {\left (2 \, C a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 2 \, B b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + C b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 2 \, C a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 2 \, B b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + C b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 1\right )}^{2} b^{2}}}{2 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 8.02, size = 2500, normalized size = 17.48 \begin {gather*} \text {Too large to display} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________